package com.nineclock.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nineclock.system.pojo.SysCompany;
import com.nineclock.system.pojo.SysCompanyUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * @author 黑马程序员
 * @Company http://www.ithiema.com
 * @Version 1.0
 */
@Mapper
public interface SysCompanyMapper extends BaseMapper<SysCompany> {

    @Select("select scu.* " +
            "from sys_role sr, sys_company_user_role scur, sys_company_user scu " +
            "where sr.role_name = 'ROLE_ADMIN_SYS' and sr.company_id = #{companyId} " +
            "and sr.id = scur.role_id and scu.id = scur.company_user_id")
    SysCompanyUser getCurrentAdmin(Long companyId);
}
